/*
 * @Description: 位置定位样式
 * @Author: linpan(45650368@qq.com)
 * @Date: 2022-11-23 15:22:53
 * @LastEditors: vusui 45650368@qq.com
 * @LastEditTime: 2023-06-01 10:26:29
 * @WebSite: https://vusui.com
 * @Copyright: 2017-present The Vusui Authors
 * @Readme: 开源不易，且用且珍惜！
 */
@use "sass:math";

#{$v}fixed {
  position: fixed !important;
}
#{$v}absolute {
  position: absolute !important;
}
#{$v}relative {
  position: relative !important;
}

/*------------------------------
 * 位置距离
 *------------------------------
*/
$numberList: 1 2 3 4 5 6 7 8 9 10 12 14 15 16 18 20 22 24 25 26 28 30 32 34 35
  36 38 40 42 44 45 46 48 50 0;

@for $i from 1 through length($numberList) {
  #{$v}left-#{nth($numberList, $i)} {
    left: #{math.div(nth($numberList, $i), 16)}rem !important;
  }
  #{$v}left--#{nth($numberList, $i)} {
    left: -#{math.div(nth($numberList, $i), 16)}rem !important;
  }
  #{$v}top-#{nth($numberList, $i)} {
    top: #{math.div(nth($numberList, $i), 16)}rem !important;
  }
  #{$v}top--#{nth($numberList, $i)} {
    top: -#{math.div(nth($numberList, $i), 16)}rem !important;
  }
  #{$v}right-#{nth($numberList, $i)} {
    right: #{math.div(nth($numberList, $i), 16)}rem !important;
  }
  #{$v}right--#{nth($numberList, $i)} {
    right: -#{math.div(nth($numberList, $i), 16)}rem !important;
  }
  #{$v}bottom-#{nth($numberList, $i)} {
    bottom: #{math.div(nth($numberList, $i), 16)}rem !important;
  }
  #{$v}bottom--#{nth($numberList, $i)} {
    bottom: -#{math.div(nth($numberList, $i), 16)}rem !important;
  }
}

#{$v}left-0 {
  left: 0 !important;
}
#{$v}top-0 {
  top: 0 !important;
}
#{$v}right-0 {
  right: 0 !important;
}
#{$v}bottom-0 {
  bottom: 0 !important;
}

/*------------------------------
 * 百分比(percent)
 *------------------------------
*/
$numberList2: 50 100;
@for $i from 1 through length($numberList2) {
  #{$v}left-p-#{nth($numberList2, $i)} {
    left: #{nth($numberList2, $i) * 1%} !important;
  }
  #{$v}left-p--#{nth($numberList2, $i)} {
    left: -#{nth($numberList2, $i) * 1%} !important;
  }
  #{$v}top-p-#{nth($numberList2, $i)} {
    top: #{nth($numberList2, $i) * 1%} !important;
  }
  #{$v}top-p--#{nth($numberList2, $i)} {
    top: -#{nth($numberList2, $i) * 1%} !important;
  }
  #{$v}right-p-#{nth($numberList2, $i)} {
    right: #{nth($numberList2, $i) * 1%} !important;
  }
  #{$v}right-p--#{nth($numberList2, $i)} {
    right: -#{nth($numberList2, $i) * 1%} !important;
  }
  #{$v}bottom-p-#{nth($numberList2, $i)} {
    bottom: #{nth($numberList2, $i) * 1%} !important;
  }
  #{$v}bottom-p--#{nth($numberList2, $i)} {
    bottom: -#{nth($numberList2, $i) * 1%} !important;
  }
}

/*------------------------------
 * 位置索引层
 *------------------------------
*/
$numberList3: -1 0 1 2 3 4 5 6 7 8 9 10;
@for $i from 1 through length($numberList3) {
  #{$v}index-#{nth($numberList3, $i)} {
    z-index: #{nth($numberList3, $i)} !important;
  }
}

// 媒体设备
@each $device, $value in $media-min-width {
  @include media-min($device) {
    @for $i from 1 through length($numberList) {
      #{$v}left-#{$device}-#{nth($numberList, $i)} {
        left: #{math.div(nth($numberList, $i), 16)}rem !important;
      }
      #{$v}left-#{$device}--#{nth($numberList, $i)} {
        left: -#{math.div(nth($numberList, $i), 16)}rem !important;
      }
      #{$v}top-#{$device}-#{nth($numberList, $i)} {
        top: #{math.div(nth($numberList, $i), 16)}rem !important;
      }
      #{$v}top-#{$device}--#{nth($numberList, $i)} {
        top: -#{math.div(nth($numberList, $i), 16)}rem !important;
      }
      #{$v}right-#{$device}-#{nth($numberList, $i)} {
        right: #{math.div(nth($numberList, $i), 16)}rem !important;
      }
      #{$v}right-#{$device}--#{nth($numberList, $i)} {
        right: -#{math.div(nth($numberList, $i), 16)}rem !important;
      }
      #{$v}bottom-#{$device}-#{nth($numberList, $i)} {
        bottom: #{math.div(nth($numberList, $i), 16)}rem !important;
      }
      #{$v}bottom-#{$device}--#{nth($numberList, $i)} {
        bottom: -#{math.div(nth($numberList, $i), 16)}rem !important;
      }
    }

    #{$v}left-#{$device}-0 {
      left: 0 !important;
    }
    #{$v}top-#{$device}-0 {
      top: 0 !important;
    }
    #{$v}right-#{$device}-0 {
      right: 0 !important;
    }
    #{$v}bottom-#{$device}-0 {
      bottom: 0 !important;
    }

    @for $i from 1 through length($numberList3) {
      #{$v}index-#{$device}-#{nth($numberList3, $i)} {
        z-index: #{nth($numberList3, $i)} !important;
      }
    }
  }
}
